<?php
/**
 * The template for displaying archive pages
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Seventeen
 * @since 1.0
 * @version 1.0
 */

get_header("projects"); ?>

<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/projects.css" />
<script src="<?php echo get_template_directory_uri(); ?>/js/projects.js"></script>

<div class="wrapi body body2 body3">
	
	<?php
		$curtag = urldecode(get_query_var( 'tag' ));
	?>

	<ul class="nav">
		<li style="width:50px" id="link1" onclick='link("")' class="<?php if($curtag == '') echo 'active' ?>" data-chn="全部" data-eng="All">&nbsp;</li>
		<li style="width:167px" id="link2" onclick='link("城市规划")' class="<?php if($curtag == '城市规划') echo 'active' ?>" data-chn="城市规划" data-eng="Urban Planning"></li>
		<li style="width:101px" id="link3" onclick='link("建筑")' class="<?php if($curtag == '建筑') echo 'active' ?>" data-chn="建筑" data-eng="Architecture"></li>
		<li style="width:101px" id="link4" onclick='link("景观")' class="<?php if($curtag == '景观') echo 'active' ?>" data-chn="景观" data-eng="Landscape"></li>
	</ul>

	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">
		
		<ul class="demos">
			<?php
			/* Start the Loop */
			$count = 15;
			$tag_bn = array(
				"城市规划",
			    "建筑",
				"景观",
				"Landscape",
				"Architecture",
				"Urban Planning"
			);
			
			while ( have_posts() ) : the_post();

				/*
				 * Include the Post-Format-specific template for the content.
				 * If you want to override this in a child theme, then include a file
				 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
				 */
				// get_template_part( 'template-parts/post/content', get_post_format() );
				$count = $count - 1;
				$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
				?>
					<li data-p="">
						<a href="<?php echo esc_url( get_permalink() ); ?>">
						<img src="<?php echo $large_image_url[0] ?>">
						<div class="info">
							<p class="name"><?php echo get_the_title(); ?></p>
							<div class="city">
								<?php
									$tags = wp_get_post_tags($post->ID);
									foreach ($tags as $tag) {
										if (in_array($tag->name, $tag_bn)) {
											continue;
										}
								?>
										<p class=""><?php echo $tag->name; ?></p>
								<?php
									}
								?>
							</div>
						</div>
						</a>
					</li>

	
		<?php  
			endwhile;

			while ($count > 0) {
				$count = $count - 1;
		?>
			<li>
				<div class="info none">
				</div>
			</li>
		<?php
			}
		?>

		</ul>
		<div class="page">
		<?php

			the_posts_pagination( array(
				'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
				'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
				'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
			) );

		 ?>
		</div>

		</main><!-- #main -->
	</div><!-- #primary -->
	<!--?php get_sidebar(); ?-->
</div><!-- .wrap -->

<?php get_footer();
